package 日期与时间;

import java.time.*;

public class Test {//计算到达目标地的当地时间
	public static void main(String[] args) {
//		LocalDateTime departureAtPeking=LocalDateTime.of(2019,10,20,13,0,0);
		LocalDateTime departureAtPeking=LocalDateTime.now();
		int hours=13;
		int minutes=20;
		LocalDateTime arrivalAtNowYork=calculateArrivalAtNY(departureAtPeking,hours,minutes);
		System.out.println(departureAtPeking+"---->"+arrivalAtNowYork);
	}
	static LocalDateTime calculateArrivalAtNY(LocalDateTime p,int h,int m) {
		LocalDateTime bj=p.plusHours(h).plusMinutes(m);
		System.out.println(bj);
		ZonedDateTime zbj=bj.atZone(ZoneId.systemDefault());
		ZonedDateTime zny=zbj.withZoneSameInstant(ZoneId.of("America/New_York"));
		return zny.toLocalDateTime();
	}
}